<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/11/0011
 * Time: 14:01
 */

namespace app\sports_admin\controller;


use think\Request;
use app\sports_admin\model\WatchInstructionsRecord as WatchInstructionsRecordModel;
use app\sports_admin\service\WatchInstructionsRecordInfo as WatchInstructionsRecordInfoService;
class WatchInstructionsRecord extends Base
{
    /*
     * 指令类型首页
     */
    public function index()
    {
        return view('index');
    }
    /**
     * 获取步数信息
     * @param $page 第几页
     * @param $rows 每页显示的条数
     * @param $sort 要排序的字段
     * @param $sortOrder 升序/降序
     * @param $searchName 要检索的字段
     * @param $start 开始时间
     * @param $end 结束时间
     */
    public function getWatchInstructionsRecordInfo()
    {
        $params = Request::instance()->only(['page','rows','sort','sortOrder','searchName','start','end']);
        $page = intval($params['page']) ? intval($params['page']) : 1;
        $rows = intval($params['rows']) ? intval($params['rows']) : 15;
        $sort = trim($params['sort']) ? trim($params['sort']) : 'id';
        $sortOrder = trim($params['sortOrder']) ? trim($params['sortOrder']) : 'asc';
        $searchName = trim($params['searchName']);
        $start = trim($params['start']);
        $end = trim($params['end']);
        return WatchInstructionsRecordModel::getWatchInstructionsRecordInfo($page,$rows,$sort,$sortOrder,$searchName,$start,$end);
    }
    /**
     * 打开检测模式
     */
    public function open()
    {
        if(request()->isAjax()) {
            return WatchInstructionsRecordInfoService::open();
        }
    }
    /**
     * 关闭检测模式
     */
    public function close()
    {
        if(request()->isAjax()) {
            return WatchInstructionsRecordInfoService::close();
        }
    }
    /**
     * 下发编号
     */
    public function number()
    {
        if(request()->isAjax()) {
            return WatchInstructionsRecordInfoService::number();
        }
    }
    /**
     * 重启或关机
     */
    public function restartOrShutdown()
    {
        if(request()->isAjax()) {
            return WatchInstructionsRecordInfoService::restartOrShutdown();
        }
    }
    /**
     * 开启或关闭关爱模式
     */
    public function careOrCloseCare()
    {
        if(request()->isAjax()) {
            return WatchInstructionsRecordInfoService::careOrCloseCare();
        }
    }
    /**
     * 下发通讯录
     */
    public function mailList()
    {
        if(request()->isAjax()) {
            return WatchInstructionsRecordInfoService::mailList();
        }
    }
}